home *** CD-ROM | disk | FTP | other *** search
/ Aminet 4 / Aminet 4 - November 1994.iso / aminet / comm / term / vltj5867.lha / VLT / rexx / VLTMouse.rexx < prev    next >
OS/2 REXX Batch file  |  1994-03-27  |  2KB  |  60 lines

  1. /** VLTMouse.rexx
  2. *
  3. *   Example of how to receive mouse move messages from VLT and to
  4. *   extract the line the user clicked on. This macro takes the
  5. *   VLT port name and screen name as arguments.
  6. *
  7. **/
  8. parse arg vltport vltscreen .
  9. address value vltport
  10. /*
  11. *   Add libraries if necessary
  12. */
  13. if show("l", "rexxarplib.library") = 0 then do
  14.    check = addlib('rexxsupport.library', 0, -30, 0)
  15.    check = addlib('rexxarplib.library',  0, -30, 0)
  16. end
  17.  
  18. quitflag = 0
  19.  
  20. mp = openport(vltport'MOUSE')
  21.  
  22. do forever
  23.    if quitflag = 1 then leave
  24.    t = waitpkt(vltport'MOUSE')
  25.    do forever
  26.       p = getpkt(vltport'MOUSE')
  27.       if c2d(p) = 0 then leave
  28.  
  29.       string = getarg(p)
  30.       t = reply(p, 0)
  31.  
  32.       parse var string xx yy xold yold xtot ytot qual
  33.  
  34.       "extract x"
  35.       "extract y"
  36.       "movecursor "||xx||" "||yy
  37.       "extract reviewlineatcursor"
  38.       "movecursor "||VLT.x||" "||VLT.y
  39.       str = VLT.reviewlineatcursor
  40.  
  41.       vltwidth  = ScreenCols(vltscreen)     /* Find size of VLT screen. */
  42.       vltheight = ScreenRows(vltscreen)
  43.       if vltwidth == -1 then do         /* If width was -1, it was */
  44.          vltwidth  = ScreenCols()       /* a Workbench window.     */
  45.          vltheight = ScreenRows()
  46.       end
  47.       vltwidth  = vltwidth  -  48
  48.       vltheight = vltheight - 100
  49.  
  50.       if length(str) * 8 > vltwidth then str = left(str, vltwidth % 8)
  51.  
  52.       str = request(0, vltheight % 4, "Edit and send:",str,,"Cancel", vltscreen)
  53.       if str ~= "" then 'send raw ('||str||')'
  54.    end
  55. end
  56.  
  57. /* This example doesn't really ever: */
  58. exit
  59.  
  60.